a=[7,1,3,4,8,9,2,5]
dp=[0,0,0,0,0,0,0,0]
for i in range(2,len(a)):
    dp[i] = min(dp[i-1]+a[i-1],dp[i-2]+a[i-2])
print(dp)